
<div id="map_<?php echo $this->params->id; ?>" class="gmap<?php echo $this->params->css_suffix; ?>">
	
	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=<?php if ($this->params->sensor) echo 'true'; else echo 'false'; ?>"></script>
	
	<script type="text/javascript">
		
		var map_<?php echo $this->params->id; ?>;
		var map_<?php echo $this->params->id; ?>_overlays = [];
		
		
		function initialize_map_<?php echo $this->params->id; ?>()
		{
			var latlng = new google.maps.LatLng(<?php echo $this->params->center_lat; ?>, <?php echo $this->params->center_lng; ?>);
			
			var myOptions = {
				zoom: <?php echo $this->params->zoom_level; ?>,
				center: latlng,
				scaleControl: <?php if ($this->params->scaleControl) echo 'true'; else echo 'false'; ?>,
				navigationControl: <?php if ($this->params->navigationControl) echo 'true'; else echo 'false'; ?>,
				mapTypeControl: <?php if($this->params->mapTypeControl) echo 'true'; else echo 'false'; ?>,
				streetViewControl: <?php if($this->params->streetViewControl) echo 'true'; else echo 'false'; ?>,
				mapTypeId: google.maps.MapTypeId.<?php echo $this->params->mapTypeId; ?>
			};
			
			map_<?php echo $this->params->id; ?> = new google.maps.Map(document.getElementById("map_<?php echo $this->params->id; ?>_canvas"),
			myOptions);
			
			<?php if ($this->params->kml != ""): ?>
			var kmlLayer = new google.maps.KmlLayer('<?php echo $this->params->kml; ?>');
			kmlLayer.setMap(map_<?php echo $this->params->id; ?>);
			<?php endif; ?>
			
			
		}
		
		function add_kml_layer_map_<?php echo $this->params->id; ?>(url)
		{
			var kmlLayer = new google.maps.KmlLayer(url);
			map_<?php echo $this->params->id; ?>_overlays.push(kmlLayer);
			kmlLayer.setMap(map_<?php echo $this->params->id; ?>);
		}
		
		function clear_overlays_map_<?php echo $this->params->id; ?>()
		{
			if (map_<?php echo $this->params->id; ?>_overlays.length >= 1)
			{
				for (i = 0; i < map_<?php echo $this->params->id; ?>_overlays.length; i++)
				{
					map_<?php echo $this->params->id; ?>_overlays[i].setMap(null);
				}
			}
		}
		
	</script>
	
	<div id="map_<?php echo $this->params->id; ?>_canvas"></div>
	
</div>
